// 延期柱状图
export function postpie(data) {
    let arr = []
    data.sales_type.forEach(element => {
        let obj = {}
        obj.name = element.refund_phase=="onsale"?"售中退款":"售后退款"
        arr.push(obj)
    });
    data.sales_list.forEach((element,index) => {
        arr[index].value = element
    });
    return {
        // title: {
        //     text: '某站点用户访问来源',
        //     subtext: '纯属虚构',
        //     left: 'center'
        // },
        tooltip: {
            trigger: 'item'
        },
        legend: {
            orient: 'vertical',
            left: 'left',
        },
        series: [
            {
                type: 'pie',
                radius: '50%',
                data: arr,
                emphasis: {
                    itemStyle: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                }
            }
        ]
    }

}

export function postpiekong(data) {
    let arr = []
    data.refund_type.forEach(element => {
        let obj = {}
        obj.name = element.has_good_return=="false"?"仅退款":"退货退款"
        arr.push(obj)
    });
    data.refund_list.forEach((element,index) => {
        arr[index].value = element
    });
    return {
        tooltip: {
            trigger: 'item'
        },
        legend: {
            top: '5%',
            left: 'center'
        },
        series: [
            {
                type: 'pie',
                radius: ['40%', '70%'],
                avoidLabelOverlap: false,
                itemStyle: {
                    borderRadius: 10,
                    borderColor: '#fff',
                    borderWidth: 2
                },
                label: {
                    show: false,
                    position: 'center'
                },
                emphasis: {
                    label: {
                        show: true,
                        fontSize: '40',
                        fontWeight: 'bold'
                    }
                },
                labelLine: {
                    show: false
                },
                data: arr
            }
        ]
    }
}

